{// 引入标签库 }
<tagLib name="html" />
<include file="Public:header" />
<php>
	function get_supplier_cate($cate_id)
	{
		return M("DealCate")->where("id=".$cate_id)->getField("name");
	}
	function getSupplierLocationLink($id)
	{
		$count = M("SupplierLocation")->where("supplier_id=".$id)->count();
		if($count==0)
		{
			$str = l("SUPPLIER_LOCATION_MUST");
		}
		else
		{
			$str = sprintf(l("SUPPLIER_LOCATION_COUNT"),$count);
		}
		return "<a href='javascript:supplier_location(\"".$id."\")'>".l("SUPPLIER_LOCATION_INDEX")."</a> [ <span style='color:red;'>".$str."</span> ]";
	}
</php>
<script type="text/javascript">
	function supplier_location(id)
	{
		location.href = ROOT+"?"+VAR_MODULE+"=SupplierLocation&"+VAR_ACTION+"=index&supplier_id="+id;
	}
	function supplier_account(id)
	{
		location.href = ROOT+"?"+VAR_MODULE+"=SupplierAccount&"+VAR_ACTION+"=index&supplier_id="+id;
	}
</script>
<div class="main">
<div class="main_title">{$main_title}</div>
<div class="blank5"></div>
<div class="button_row">
	<input type="button" class="button" value="{%ADD}" onclick="add();" />
	<input type="button" class="button" value="{%FOREVERDEL}" onclick="foreverdel();" />
</div>
<div class="blank5"></div>
<html:list 
	id="dataTable" 
	style="dataTable" 
	name="supplier" 
	checkbox="true" 
	action="true" 
	datasource="list" 
	show="id:{%ID}|50px,name:{%NAME}:edit,cate_id|get_supplier_cate:{%CATE_TREE},sort|get_sort=$supplier['id']:{%SORT}" 
	actionlist="edit:{%EDIT}, foreverdel:{%FOREVERDEL},supplier_account:{%SUPPLIER_ACCOUNT_INDEX},id|getSupplierLocationLink" /> 

<div class="blank5"></div>
<div class="page">{$page}</div>
</div>
<include file="Public:footer" />